package zy.blue7.im.core.utils;

import java.io.*;

/**
 * @Author: blue7
 * @Date: 2022/2/27 18:26
 * @Version 1.0
 * @Description
 */
public class SerializableUtils {

    public static byte[] serializable(Object obj) throws IOException {
        ByteArrayOutputStream baos =new ByteArrayOutputStream();
        ObjectOutputStream oos =new ObjectOutputStream(baos);
        oos.writeObject(obj);
        return baos.toByteArray();
    }


    public static Object dSerializable(byte [] src) throws Exception{
        ByteArrayInputStream baos =new ByteArrayInputStream(src);
        ObjectInputStream oos =new ObjectInputStream(baos);

        return oos.readObject();
    }
}
